﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RPGXEngine
{
    public static class VariableTypeFactory
    {
        public static IVariableType Create(DataType dt, string name, object value = null)
        {
            IVariableType vt = null;

            switch (dt)
            {
                case DataType.Void:
                    vt = new VoidVariableType(name);
                    break;
                case DataType.Var:
                    vt = new VarVariableType(name);
                    break;
                case DataType.Array:
                    vt = new ArrayVariableType(name);
                    break;
                default:
                    // emmit compiler error here...
                    vt = new VarVariableType(name);
                    break;
            }

            vt.SetValue(value);

            return vt;
        }
    }
}
